#!/usr/local/bin/php
<?php

$table = false;
$app = realpath( 'www' );

if( $argc >= 1 ) {
	$table = $argv[1];
	
	if( $argc >= 2 ) {
		$app = $argv[2];
	}
}

if( file_exists( $app.'/foundry.config.php' ) ) {
	include_once( $app.'/foundry.config.php' );
}

$dba = Foundry::load( 'DB_FoundryDbAnalyzer' );

echo "Analyzer loaded\n"
	."Analyzing tables\n";

$dba->analyze();

echo "Done\n\n"
	."Generating datatypes file...\n";
	
$dba->writeConfFile( realpath( $app.'/../config/datatypes.conf' ) );


echo "Done\n";

?>
